{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "2025-08-11 23:22:45,331 [INFO] runing in interactive session [<module>] (D:\\workspace\\hikyuu\\hikyuu\\__init__.py:109) [hikyuu::hku_info]\n",
      "2025-08-11 23:22:45,331 [INFO] running in jupyter [<module>] (D:\\workspace\\hikyuu\\hikyuu\\__init__.py:116) [hikyuu::hku_info]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "current plugin path: D:\\workspace\\hikyuu\\hikyuu\\plugin\n",
      "2025-08-11 23:22:45.391 [HKU-I] - Using MYSQL BaseInfoDriver (BaseInfoDriver.cpp:57)\n",
      "2025-08-11 23:22:45.415 [HKU-I] - 加载市场信息…… (StockManager.cpp:572)\n",
      "2025-08-11 23:22:45.422 [HKU-I] - 加载证券类型信息…… (StockManager.cpp:590)\n",
      "2025-08-11 23:22:45.429 [HKU-I] - 加载证券信息…… (StockManager.cpp:476)\n",
      "2025-08-11 23:22:45.540 [HKU-I] - 加载权息数据…… (StockManager.cpp:608)\n",
      "2025-08-11 23:22:46.589 [HKU-I] - 加载板块信息…… (StockManager.cpp:181)\n",
      "2025-08-11 23:22:47.718 [HKU-I] - 加载K线数据…… (StockManager.cpp:185)\n",
      "2025-08-11 23:22:47.718 [HKU-I] - 预加载 day K线数据至缓存 (最大数量: 100000)! (StockManager.cpp:229)\n",
      "2025-08-11 23:22:47.719 [HKU-I] - 2.32 秒数据加载完毕. (StockManager.cpp:191)\n",
      "2025-08-11 23:22:47.719 [HKU-I] - 启动行情接收. (SpotAgent.cpp:39)\n",
      "CPU times: total: 1.52 s\n",
      "Wall time: 3.43 s\n"
     ]
    }
   ],
   "source": [
    "#%matplotlib inline\n",
    "%time from hikyuu.interactive import *"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 1 利用 TM 实现简单的记账本\n",
    "\n",
    "TradeManager对象可以理解为一个模拟的交易账户，负责交易的买/卖操作、记录交易记录以及持仓情况，也可以通过修改其买/卖操作的接口实现实盘接入。创建一个模拟交易账户，通常使用快捷创建函数 crtTM。TM对象的基本操作：\n",
    "\n",
    "- buy  买入\n",
    "- sell 卖出\n",
    "- checkin 存入现金\n",
    "- checkout 取出现金\n",
    "\n",
    "可以利用 TM 实现简单的记账本，手工记录自己的操作情况，例如："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "TradeManager {\n",
      "  params: params[precision(int): 2, save_action(bool): 1, support_borrow_cash(bool): 0, support_borrow_stock(bool): 0, ],\n",
      "  name: SYS,\n",
      "  init_date: 2017-01-01 00:00:00,\n",
      "  init_cash: 100000.00,\n",
      "  firstDatetime: 2017-01-03 00:00:00,\n",
      "  lastDatetime: 2017-01-03 00:00:00,\n",
      "  TradeCostFunc: TradeCostFunc(TC_Zero, params[]),\n",
      "  current total funds: 100005.00,\n",
      "  current cash: 99089.00,\n",
      "  current market_value: 916.00,\n",
      "  current short_market_value: 0.00,\n",
      "  current base_cash: 100000.00,\n",
      "  current base_asset: 0.00,\n",
      "  current borrow_cash: 0.00,\n",
      "  current borrow_asset: 0.00,\n",
      "  Position: \n",
      "    SZ000001 平安银行 2017-01-03 00:00:00 2090 100.00 911.00 1230.00 319.00 35.02% 0.32%\n",
      "  Short Position: \n",
      "  Borrow Stock: \n",
      "}\n"
     ]
    }
   ],
   "source": [
    "#创建一个初始资金10万元，起始日期2017年1月1日的模拟账户\n",
    "my_tm = crtTM(init_cash=100000, date=Datetime(201701010000))\n",
    "\n",
    "#2017年1月3日以9.11的价格买入100股\n",
    "td = my_tm.buy(Datetime(201701030000), sm['sz000001'], 9.11, 100)\n",
    "\n",
    "#查看当前资金及持仓情况\n",
    "print(my_tm)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>证券代码</th>\n",
       "      <th>证券名称</th>\n",
       "      <th>买入时间</th>\n",
       "      <th>持仓天数</th>\n",
       "      <th>持仓数量</th>\n",
       "      <th>投入金额</th>\n",
       "      <th>当前市值</th>\n",
       "      <th>盈亏金额</th>\n",
       "      <th>盈亏百分比</th>\n",
       "      <th>止损价</th>\n",
       "      <th>目标价</th>\n",
       "      <th>清仓时间</th>\n",
       "      <th>累计持有数量</th>\n",
       "      <th>累计成本</th>\n",
       "      <th>累计风险</th>\n",
       "      <th>累计买入金额</th>\n",
       "      <th>累计卖出金额</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>SZ000001</td>\n",
       "      <td>平安银行</td>\n",
       "      <td>2017-01-03</td>\n",
       "      <td>3142</td>\n",
       "      <td>100.0</td>\n",
       "      <td>911.0</td>\n",
       "      <td>1230.0</td>\n",
       "      <td>319.0</td>\n",
       "      <td>35.02</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>NaT</td>\n",
       "      <td>100.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>911.0</td>\n",
       "      <td>911.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       证券代码  证券名称       买入时间  持仓天数   持仓数量   投入金额    当前市值   盈亏金额  盈亏百分比  止损价  \\\n",
       "0  SZ000001  平安银行 2017-01-03  3142  100.0  911.0  1230.0  319.0  35.02  0.0   \n",
       "\n",
       "   目标价 清仓时间  累计持有数量  累计成本   累计风险  累计买入金额  累计卖出金额  \n",
       "0  0.0  NaT   100.0   0.0  911.0   911.0     0.0  "
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#转化为pandas的DataFrame显示当前持仓情况 \n",
    "position = my_tm.get_position_list()\n",
    "position.to_df()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>证券代码</th>\n",
       "      <th>证券名称</th>\n",
       "      <th>交易时间</th>\n",
       "      <th>业务名称</th>\n",
       "      <th>计划交易价格</th>\n",
       "      <th>实际成交价格</th>\n",
       "      <th>目标价格</th>\n",
       "      <th>交易数量</th>\n",
       "      <th>止损价</th>\n",
       "      <th>现金余额</th>\n",
       "      <th>交易总成本</th>\n",
       "      <th>佣金</th>\n",
       "      <th>印花税</th>\n",
       "      <th>过户费</th>\n",
       "      <th>其它成本</th>\n",
       "      <th>信号来源</th>\n",
       "      <th>备注</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td></td>\n",
       "      <td></td>\n",
       "      <td>2017-01-01</td>\n",
       "      <td>INIT</td>\n",
       "      <td>100000.0</td>\n",
       "      <td>100000.00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>100000.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>--</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>SZ000001</td>\n",
       "      <td>平安银行</td>\n",
       "      <td>2017-01-03</td>\n",
       "      <td>BUY</td>\n",
       "      <td>0.0</td>\n",
       "      <td>9.11</td>\n",
       "      <td>0.0</td>\n",
       "      <td>100.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>99089.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>--</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       证券代码  证券名称       交易时间  业务名称    计划交易价格     实际成交价格  目标价格   交易数量  止损价  \\\n",
       "0                 2017-01-01  INIT  100000.0  100000.00   0.0    0.0  0.0   \n",
       "1  SZ000001  平安银行 2017-01-03   BUY       0.0       9.11   0.0  100.0  0.0   \n",
       "\n",
       "       现金余额  交易总成本   佣金  印花税  过户费  其它成本 信号来源 备注  \n",
       "0  100000.0    0.0  0.0  0.0  0.0   0.0   --     \n",
       "1   99089.0    0.0  0.0  0.0  0.0   0.0   --     "
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "my_tm.get_trade_list().to_df()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "TradeManager {\n",
       "  params: params[precision(int): 2, save_action(bool): 1, support_borrow_cash(bool): 0, support_borrow_stock(bool): 0, ],\n",
       "  name: SYS,\n",
       "  init_date: 2017-01-01 00:00:00,\n",
       "  init_cash: 100000.00,\n",
       "  firstDatetime: 2017-01-03 00:00:00,\n",
       "  lastDatetime: 2017-02-21 00:00:00,\n",
       "  TradeCostFunc: TradeCostFunc(TC_Zero, params[]),\n",
       "  current total funds: 100049.00,\n",
       "  current cash: 100049.00,\n",
       "  current market_value: 0.00,\n",
       "  current short_market_value: 0.00,\n",
       "  current base_cash: 100000.00,\n",
       "  current base_asset: 0.00,\n",
       "  current borrow_cash: 0.00,\n",
       "  current borrow_asset: 0.00,\n",
       "  Position: \n",
       "  Short Position: \n",
       "  Borrow Stock: \n",
       "}"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#2017年2月21日以9.60的价格卖出100股\n",
    "td = my_tm.sell(Datetime(201702210000), sm['sz000001'], 9.60)\n",
    "\n",
    "my_tm"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 2 利用 Excel 查看交易详情\n",
    "\n",
    "使用 tocsv 方法将 TM 的交易记录、当前持仓及已平仓详细情况分别保存为 csv 文件，以便用 Excel 查看详情。\n",
    "\n",
    "tocsv方法参数为一个指定的目录，目录必须以存在。其输出会在指定目录中，生成三个文件，“TM名称_交易记录.csv”、“TM名称_未平仓记录.csv”、“TM名称_已平仓记录.csv”。TM名称可在crtTM创建TM对象时指定，默认为“SYS”，如下图所示。\n",
    "\n",
    "<img src=\"images/008_01_tocsv.png\" align='left'>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "#在 hikyuu_XXX.ini 文件中配置的临时路径中输出\n",
    "my_tm.tocsv(sm.tmpdir())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "使用 Excel 查看 csv，如：\n",
    "\n",
    "<img src=\"images/008_02_tocsv_look.png\" align=\"left\">"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 3 使用序列化保存或重新载入已有TM对象"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "#保存至指定文件\n",
    "from datetime import date\n",
    "filename = \"{}/my_trade/my_trade_record_{}.xml\".format(sm.tmpdir(), date.today());\n",
    "hku_save(my_tm, filename)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "#载入已保存的TM对象\n",
    "#filename = \"{}/my_trade/my_trade_record_{}.xml\".format(sm.tmpdir(), date.today())\n",
    "new_my_tm = hku_load(filename)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "使用 hku_save 保存的对象，其格式为XML文件，可直接使用 XML 工具或浏览器查看：\n",
    "\n",
    "<img src=\"images/008_03_pickle.png\" align=\"left\">"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 4 使用订单代理"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "买入：SZ000001, 价格: 11.4, 数量: 1000.0 预期止损价: 0.0, 预期目标价: nan, 信号来源: SystemPart.SIGNAL, 备注: \n",
      "卖出：SZ000001, 价格: 11.53, 数量: 1000.0, 信号来源: SystemPart.SIGNAL, 备注: \n",
      "买入：SZ000001, 价格: 11.58, 数量: 1000.0 预期止损价: 0.0, 预期目标价: nan, 信号来源: SystemPart.SIGNAL, 备注: \n",
      "卖出：SZ000001, 价格: 11.52, 数量: 1000.0, 信号来源: SystemPart.SIGNAL, 备注: \n",
      "买入：SZ000001, 价格: 11.69, 数量: 1000.0 预期止损价: 0.0, 预期目标价: nan, 信号来源: SystemPart.SIGNAL, 备注: \n",
      "卖出：SZ000001, 价格: 11.48, 数量: 1000.0, 信号来源: SystemPart.SIGNAL, 备注: \n",
      "买入：SZ000001, 价格: 11.0, 数量: 1000.0 预期止损价: 0.0, 预期目标价: nan, 信号来源: SystemPart.SIGNAL, 备注: \n",
      "卖出：SZ000001, 价格: 11.0, 数量: 1000.0, 信号来源: SystemPart.SIGNAL, 备注: \n",
      "买入：SZ000001, 价格: 11.07, 数量: 1000.0 预期止损价: 0.0, 预期目标价: nan, 信号来源: SystemPart.SIGNAL, 备注: \n",
      "卖出：SZ000001, 价格: 12.46, 数量: 1000.0, 信号来源: SystemPart.SIGNAL, 备注: \n",
      "买入：SZ000001, 价格: 12.48, 数量: 1000.0 预期止损价: 0.0, 预期目标价: nan, 信号来源: SystemPart.SIGNAL, 备注: \n",
      "卖出：SZ000001, 价格: 12.4, 数量: 1000.0, 信号来源: SystemPart.SIGNAL, 备注: \n"
     ]
    }
   ],
   "source": [
    "#创建模拟交易账户进行回测，初始资金30万\n",
    "my_tm = crtTM(init_cash=300000, date=Datetime(201701010000))\n",
    "\n",
    "#注册实盘交易订单代理\n",
    "ob = crtOB(TestOrderBroker())\n",
    "my_tm.reg_broker(ob) #TestOerderBroker是测试用订单代理对象，只打印\n",
    "# 注意：pybind 不支持下面这种方式调用，必须先生成实例再传入！！！\n",
    "# my_tm.reg_broker(crtOB(TestOrderBroker(), False))\n",
    "\n",
    "#根据需要修改订单代理最后的时间戳，后续只有大于该时间戳时，订单代理才会实际发出订单指令\n",
    "my_tm.broker_last_datetime=Datetime(201701010000)\n",
    "\n",
    "#创建信号指示器（以5日EMA为快线，5日EMA自身的10日EMA作为慢线，快线向上穿越慢线时买入，反之卖出）\n",
    "my_sg = SG_Flex(EMA(C, n=5), slow_n=10)\n",
    "\n",
    "#固定每次买入1000股\n",
    "my_mm = MM_FixedCount(1000)\n",
    "\n",
    "#创建交易系统并运行\n",
    "sys = SYS_Simple(tm = my_tm, sg = my_sg, mm = my_mm)\n",
    "sys.run(sm['sz000001'], Query(-150))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>证券代码</th>\n",
       "      <th>证券名称</th>\n",
       "      <th>交易时间</th>\n",
       "      <th>业务名称</th>\n",
       "      <th>计划交易价格</th>\n",
       "      <th>实际成交价格</th>\n",
       "      <th>目标价格</th>\n",
       "      <th>交易数量</th>\n",
       "      <th>止损价</th>\n",
       "      <th>现金余额</th>\n",
       "      <th>交易总成本</th>\n",
       "      <th>佣金</th>\n",
       "      <th>印花税</th>\n",
       "      <th>过户费</th>\n",
       "      <th>其它成本</th>\n",
       "      <th>信号来源</th>\n",
       "      <th>备注</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td></td>\n",
       "      <td></td>\n",
       "      <td>2017-01-01</td>\n",
       "      <td>INIT</td>\n",
       "      <td>300000.00</td>\n",
       "      <td>300000.00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>300000.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>--</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>SZ000001</td>\n",
       "      <td>平安银行</td>\n",
       "      <td>2025-02-11</td>\n",
       "      <td>BUY</td>\n",
       "      <td>11.40</td>\n",
       "      <td>11.40</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1000.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>288600.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>SG</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>SZ000001</td>\n",
       "      <td>平安银行</td>\n",
       "      <td>2025-02-27</td>\n",
       "      <td>SELL</td>\n",
       "      <td>11.53</td>\n",
       "      <td>11.53</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1000.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>300130.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>SG</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>SZ000001</td>\n",
       "      <td>平安银行</td>\n",
       "      <td>2025-02-28</td>\n",
       "      <td>BUY</td>\n",
       "      <td>11.58</td>\n",
       "      <td>11.58</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1000.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>288550.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>SG</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>SZ000001</td>\n",
       "      <td>平安银行</td>\n",
       "      <td>2025-03-03</td>\n",
       "      <td>SELL</td>\n",
       "      <td>11.52</td>\n",
       "      <td>11.52</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1000.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>300070.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>SG</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>SZ000001</td>\n",
       "      <td>平安银行</td>\n",
       "      <td>2025-03-06</td>\n",
       "      <td>BUY</td>\n",
       "      <td>11.69</td>\n",
       "      <td>11.69</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1000.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>288380.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>SG</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>SZ000001</td>\n",
       "      <td>平安银行</td>\n",
       "      <td>2025-03-19</td>\n",
       "      <td>SELL</td>\n",
       "      <td>11.48</td>\n",
       "      <td>11.48</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1000.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>299860.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>SG</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>SZ000001</td>\n",
       "      <td>平安银行</td>\n",
       "      <td>2025-04-21</td>\n",
       "      <td>BUY</td>\n",
       "      <td>11.00</td>\n",
       "      <td>11.00</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1000.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>288860.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>SG</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>SZ000001</td>\n",
       "      <td>平安银行</td>\n",
       "      <td>2025-04-24</td>\n",
       "      <td>SELL</td>\n",
       "      <td>11.00</td>\n",
       "      <td>11.00</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1000.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>299860.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>SG</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>SZ000001</td>\n",
       "      <td>平安银行</td>\n",
       "      <td>2025-05-09</td>\n",
       "      <td>BUY</td>\n",
       "      <td>11.07</td>\n",
       "      <td>11.07</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1000.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>288790.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>SG</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>SZ000001</td>\n",
       "      <td>平安银行</td>\n",
       "      <td>2025-06-12</td>\n",
       "      <td>BONUS</td>\n",
       "      <td>362.00</td>\n",
       "      <td>362.00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>289514.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>--</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>SZ000001</td>\n",
       "      <td>平安银行</td>\n",
       "      <td>2025-07-23</td>\n",
       "      <td>SELL</td>\n",
       "      <td>12.46</td>\n",
       "      <td>12.46</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1000.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>301612.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>SG</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>SZ000001</td>\n",
       "      <td>平安银行</td>\n",
       "      <td>2025-08-08</td>\n",
       "      <td>BUY</td>\n",
       "      <td>12.48</td>\n",
       "      <td>12.48</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1000.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>289132.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>SG</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>SZ000001</td>\n",
       "      <td>平安银行</td>\n",
       "      <td>2025-08-11</td>\n",
       "      <td>SELL</td>\n",
       "      <td>12.40</td>\n",
       "      <td>12.40</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1000.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>301532.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>SG</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        证券代码  证券名称       交易时间   业务名称     计划交易价格     实际成交价格  目标价格    交易数量  止损价  \\\n",
       "0                  2017-01-01   INIT  300000.00  300000.00   0.0     0.0  0.0   \n",
       "1   SZ000001  平安银行 2025-02-11    BUY      11.40      11.40   NaN  1000.0  0.0   \n",
       "2   SZ000001  平安银行 2025-02-27   SELL      11.53      11.53   NaN  1000.0  0.0   \n",
       "3   SZ000001  平安银行 2025-02-28    BUY      11.58      11.58   NaN  1000.0  0.0   \n",
       "4   SZ000001  平安银行 2025-03-03   SELL      11.52      11.52   NaN  1000.0  0.0   \n",
       "5   SZ000001  平安银行 2025-03-06    BUY      11.69      11.69   NaN  1000.0  0.0   \n",
       "6   SZ000001  平安银行 2025-03-19   SELL      11.48      11.48   NaN  1000.0  0.0   \n",
       "7   SZ000001  平安银行 2025-04-21    BUY      11.00      11.00   NaN  1000.0  0.0   \n",
       "8   SZ000001  平安银行 2025-04-24   SELL      11.00      11.00   NaN  1000.0  0.0   \n",
       "9   SZ000001  平安银行 2025-05-09    BUY      11.07      11.07   NaN  1000.0  0.0   \n",
       "10  SZ000001  平安银行 2025-06-12  BONUS     362.00     362.00   0.0     0.0  0.0   \n",
       "11  SZ000001  平安银行 2025-07-23   SELL      12.46      12.46   NaN  1000.0  0.0   \n",
       "12  SZ000001  平安银行 2025-08-08    BUY      12.48      12.48   NaN  1000.0  0.0   \n",
       "13  SZ000001  平安银行 2025-08-11   SELL      12.40      12.40   NaN  1000.0  0.0   \n",
       "\n",
       "        现金余额  交易总成本   佣金  印花税  过户费  其它成本 信号来源 备注  \n",
       "0   300000.0    0.0  0.0  0.0  0.0   0.0   --     \n",
       "1   288600.0    0.0  0.0  0.0  0.0   0.0   SG     \n",
       "2   300130.0    0.0  0.0  0.0  0.0   0.0   SG     \n",
       "3   288550.0    0.0  0.0  0.0  0.0   0.0   SG     \n",
       "4   300070.0    0.0  0.0  0.0  0.0   0.0   SG     \n",
       "5   288380.0    0.0  0.0  0.0  0.0   0.0   SG     \n",
       "6   299860.0    0.0  0.0  0.0  0.0   0.0   SG     \n",
       "7   288860.0    0.0  0.0  0.0  0.0   0.0   SG     \n",
       "8   299860.0    0.0  0.0  0.0  0.0   0.0   SG     \n",
       "9   288790.0    0.0  0.0  0.0  0.0   0.0   SG     \n",
       "10  289514.0    0.0  0.0  0.0  0.0   0.0   --     \n",
       "11  301612.0    0.0  0.0  0.0  0.0   0.0   SG     \n",
       "12  289132.0    0.0  0.0  0.0  0.0   0.0   SG     \n",
       "13  301532.0    0.0  0.0  0.0  0.0   0.0   SG     "
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "my_tm.get_trade_list().to_df()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([('', '', '2017-01-01T00:00:00.000000000', 'INIT', 3.000e+05, 3.000e+05,  0.,    0., 0., 300000., 0., 0., 0., 0., 0., '--', ''),\n",
       "       ('SZ000001', '平安银行', '2025-02-11T00:00:00.000000000', 'BUY', 1.140e+01, 1.140e+01, nan, 1000., 0., 288600., 0., 0., 0., 0., 0., 'SG', ''),\n",
       "       ('SZ000001', '平安银行', '2025-02-27T00:00:00.000000000', 'SELL', 1.153e+01, 1.153e+01, nan, 1000., 0., 300130., 0., 0., 0., 0., 0., 'SG', ''),\n",
       "       ('SZ000001', '平安银行', '2025-02-28T00:00:00.000000000', 'BUY', 1.158e+01, 1.158e+01, nan, 1000., 0., 288550., 0., 0., 0., 0., 0., 'SG', ''),\n",
       "       ('SZ000001', '平安银行', '2025-03-03T00:00:00.000000000', 'SELL', 1.152e+01, 1.152e+01, nan, 1000., 0., 300070., 0., 0., 0., 0., 0., 'SG', ''),\n",
       "       ('SZ000001', '平安银行', '2025-03-06T00:00:00.000000000', 'BUY', 1.169e+01, 1.169e+01, nan, 1000., 0., 288380., 0., 0., 0., 0., 0., 'SG', ''),\n",
       "       ('SZ000001', '平安银行', '2025-03-19T00:00:00.000000000', 'SELL', 1.148e+01, 1.148e+01, nan, 1000., 0., 299860., 0., 0., 0., 0., 0., 'SG', ''),\n",
       "       ('SZ000001', '平安银行', '2025-04-21T00:00:00.000000000', 'BUY', 1.100e+01, 1.100e+01, nan, 1000., 0., 288860., 0., 0., 0., 0., 0., 'SG', ''),\n",
       "       ('SZ000001', '平安银行', '2025-04-24T00:00:00.000000000', 'SELL', 1.100e+01, 1.100e+01, nan, 1000., 0., 299860., 0., 0., 0., 0., 0., 'SG', ''),\n",
       "       ('SZ000001', '平安银行', '2025-05-09T00:00:00.000000000', 'BUY', 1.107e+01, 1.107e+01, nan, 1000., 0., 288790., 0., 0., 0., 0., 0., 'SG', ''),\n",
       "       ('SZ000001', '平安银行', '2025-06-12T00:00:00.000000000', 'BONUS', 3.620e+02, 3.620e+02,  0.,    0., 0., 289514., 0., 0., 0., 0., 0., '--', ''),\n",
       "       ('SZ000001', '平安银行', '2025-07-23T00:00:00.000000000', 'SELL', 1.246e+01, 1.246e+01, nan, 1000., 0., 301612., 0., 0., 0., 0., 0., 'SG', ''),\n",
       "       ('SZ000001', '平安银行', '2025-08-08T00:00:00.000000000', 'BUY', 1.248e+01, 1.248e+01, nan, 1000., 0., 289132., 0., 0., 0., 0., 0., 'SG', ''),\n",
       "       ('SZ000001', '平安银行', '2025-08-11T00:00:00.000000000', 'SELL', 1.240e+01, 1.240e+01, nan, 1000., 0., 301532., 0., 0., 0., 0., 0., 'SG', '')],\n",
       "      dtype=[('证券代码', '<U10'), ('证券名称', '<U20'), ('交易时间', '<M8[ns]'), ('业务名称', '<U20'), ('计划交易价格', '<f8'), ('实际成交价格', '<f8'), ('目标价格', '<f8'), ('交易数量', '<f8'), ('止损价', '<f8'), ('现金余额', '<f8'), ('交易总成本', '<f8'), ('佣金', '<f8'), ('印花税', '<f8'), ('过户费', '<f8'), ('其它成本', '<f8'), ('信号来源', '<U20'), ('备注', '<U100')])"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "my_tm.get_trade_list().to_np()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>证券代码</th>\n",
       "      <th>证券名称</th>\n",
       "      <th>买入时间</th>\n",
       "      <th>持仓天数</th>\n",
       "      <th>持仓数量</th>\n",
       "      <th>投入金额</th>\n",
       "      <th>当前市值</th>\n",
       "      <th>盈亏金额</th>\n",
       "      <th>盈亏百分比</th>\n",
       "      <th>止损价</th>\n",
       "      <th>目标价</th>\n",
       "      <th>清仓时间</th>\n",
       "      <th>累计持有数量</th>\n",
       "      <th>累计成本</th>\n",
       "      <th>累计风险</th>\n",
       "      <th>累计买入金额</th>\n",
       "      <th>累计卖出金额</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>SZ000001</td>\n",
       "      <td>平安银行</td>\n",
       "      <td>2025-02-11</td>\n",
       "      <td>16</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-130.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>130.0</td>\n",
       "      <td>-100.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2025-02-27</td>\n",
       "      <td>1000.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>11400.0</td>\n",
       "      <td>11400.0</td>\n",
       "      <td>11530.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>SZ000001</td>\n",
       "      <td>平安银行</td>\n",
       "      <td>2025-02-28</td>\n",
       "      <td>3</td>\n",
       "      <td>0.0</td>\n",
       "      <td>60.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-60.0</td>\n",
       "      <td>-100.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2025-03-03</td>\n",
       "      <td>1000.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>11580.0</td>\n",
       "      <td>11580.0</td>\n",
       "      <td>11520.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>SZ000001</td>\n",
       "      <td>平安银行</td>\n",
       "      <td>2025-03-06</td>\n",
       "      <td>13</td>\n",
       "      <td>0.0</td>\n",
       "      <td>210.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-210.0</td>\n",
       "      <td>-100.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2025-03-19</td>\n",
       "      <td>1000.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>11690.0</td>\n",
       "      <td>11690.0</td>\n",
       "      <td>11480.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>SZ000001</td>\n",
       "      <td>平安银行</td>\n",
       "      <td>2025-04-21</td>\n",
       "      <td>3</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2025-04-24</td>\n",
       "      <td>1000.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>11000.0</td>\n",
       "      <td>11000.0</td>\n",
       "      <td>11000.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>SZ000001</td>\n",
       "      <td>平安银行</td>\n",
       "      <td>2025-05-09</td>\n",
       "      <td>75</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-1752.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1752.0</td>\n",
       "      <td>-100.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2025-07-23</td>\n",
       "      <td>1000.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>11070.0</td>\n",
       "      <td>11070.0</td>\n",
       "      <td>12822.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>SZ000001</td>\n",
       "      <td>平安银行</td>\n",
       "      <td>2025-08-08</td>\n",
       "      <td>3</td>\n",
       "      <td>0.0</td>\n",
       "      <td>80.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-80.0</td>\n",
       "      <td>-100.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2025-08-11</td>\n",
       "      <td>1000.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>12480.0</td>\n",
       "      <td>12480.0</td>\n",
       "      <td>12400.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       证券代码  证券名称       买入时间  持仓天数  持仓数量    投入金额  当前市值    盈亏金额  盈亏百分比  止损价  \\\n",
       "0  SZ000001  平安银行 2025-02-11    16   0.0  -130.0   0.0   130.0 -100.0  0.0   \n",
       "1  SZ000001  平安银行 2025-02-28     3   0.0    60.0   0.0   -60.0 -100.0  0.0   \n",
       "2  SZ000001  平安银行 2025-03-06    13   0.0   210.0   0.0  -210.0 -100.0  0.0   \n",
       "3  SZ000001  平安银行 2025-04-21     3   0.0     0.0   0.0     0.0    0.0  0.0   \n",
       "4  SZ000001  平安银行 2025-05-09    75   0.0 -1752.0   0.0  1752.0 -100.0  0.0   \n",
       "5  SZ000001  平安银行 2025-08-08     3   0.0    80.0   0.0   -80.0 -100.0  0.0   \n",
       "\n",
       "   目标价       清仓时间  累计持有数量  累计成本     累计风险   累计买入金额   累计卖出金额  \n",
       "0  NaN 2025-02-27  1000.0   0.0  11400.0  11400.0  11530.0  \n",
       "1  NaN 2025-03-03  1000.0   0.0  11580.0  11580.0  11520.0  \n",
       "2  NaN 2025-03-19  1000.0   0.0  11690.0  11690.0  11480.0  \n",
       "3  NaN 2025-04-24  1000.0   0.0  11000.0  11000.0  11000.0  \n",
       "4  NaN 2025-07-23  1000.0   0.0  11070.0  11070.0  12822.0  \n",
       "5  NaN 2025-08-11  1000.0   0.0  12480.0  12480.0  12400.0  "
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "my_tm.get_history_position_list().to_df()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([('SZ000001', '平安银行', '2025-02-11T00:00:00.000000000', 16, 0.,  -130., 0.,  130., -100., 0., nan, '2025-02-27T00:00:00.000000000', 1000., 0., 11400., 11400., 11530.),\n",
       "       ('SZ000001', '平安银行', '2025-02-28T00:00:00.000000000',  3, 0.,    60., 0.,  -60., -100., 0., nan, '2025-03-03T00:00:00.000000000', 1000., 0., 11580., 11580., 11520.),\n",
       "       ('SZ000001', '平安银行', '2025-03-06T00:00:00.000000000', 13, 0.,   210., 0., -210., -100., 0., nan, '2025-03-19T00:00:00.000000000', 1000., 0., 11690., 11690., 11480.),\n",
       "       ('SZ000001', '平安银行', '2025-04-21T00:00:00.000000000',  3, 0.,     0., 0.,    0.,    0., 0., nan, '2025-04-24T00:00:00.000000000', 1000., 0., 11000., 11000., 11000.),\n",
       "       ('SZ000001', '平安银行', '2025-05-09T00:00:00.000000000', 75, 0., -1752., 0., 1752., -100., 0., nan, '2025-07-23T00:00:00.000000000', 1000., 0., 11070., 11070., 12822.),\n",
       "       ('SZ000001', '平安银行', '2025-08-08T00:00:00.000000000',  3, 0.,    80., 0.,  -80., -100., 0., nan, '2025-08-11T00:00:00.000000000', 1000., 0., 12480., 12480., 12400.)],\n",
       "      dtype=[('证券代码', '<U10'), ('证券名称', '<U20'), ('买入时间', '<M8[ns]'), ('持仓天数', '<i8'), ('持仓数量', '<f8'), ('投入金额', '<f8'), ('当前市值', '<f8'), ('盈亏金额', '<f8'), ('盈亏百分比', '<f8'), ('止损价', '<f8'), ('目标价', '<f8'), ('清仓时间', '<M8[ns]'), ('累计持有数量', '<f8'), ('累计成本', '<f8'), ('累计风险', '<f8'), ('累计买入金额', '<f8'), ('累计卖出金额', '<f8')])"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "my_tm.get_history_position_list().to_np()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
